package com.zhang.yygh.cmn.excel;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;

import java.util.ArrayList;
import java.util.List;

public class ExcelWriteDemo {

    //Excel写出操作
    public static void main(String[] args) {
        List<Student> students = new ArrayList<>();
        students.add(new Student(1,"路飞",20,true));
        students.add(new Student(2,"娜美",18,false));
        students.add(new Student(3,"索隆",23,true));
        /**
         * workbook:工作簿
         *  sheet:工作表
         *      row：表
         *          cell:单元格
         */
        EasyExcel.write("C:\\Users\\zbw\\Desktop\\abc.xlsx",Student.class).registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
                .sheet("学生列表").doWrite(students);
    }
}
